<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>
    <button id="ldh"> 刘德华</button>
    <button id="zxy"> 张学友</button>
    <br>
    <img src="images/ldh.jpeg" alt="" width=200 title="刘德华">
    <script>
        var ldh = document.getElementById('ldh');
        var zxy = document.querySelector('#zxy');
        var img = document.querySelector('img');
        zxy.onclick = () => {
            img.src = "images/zxy.jpeg";
            img.title = '张学友';
        }
        ldh.onclick = () => {
            img.src = "images/ldh.jpeg";
            img.title = '刘德华';
        }
    </script>
</body>


</html>